.TH CLINFO 1 "2023-01-25" "clinfo 3.0.23.01.25"

.SH NAME

clinfo \- show OpenCL platforms and devices

.SH SYNOPSIS
.B clinfo
.RI [ "options ..." ]

.SH DESCRIPTION
.B clinfo
prints all available information about all OpenCL platforms
available on the system and the devices they expose.

.SH OPTIONS
.B clinfo
accepts the following options:
.TP 2
.BR -a ", " --all-props
try to retrieve all properties, even those not officially supported
(e.g. because they require specific extensions), but only show them
if the property could be retrieved successfully; see also the
.B LIMITATIONS
section below; note that even though this may reveal hidden properties,
there is no guarantee that the returned values are meaningful, nor that
the corresponding feature is actually available at all;
.TP
.BR -A ", " --always-all-props
like
.BR -a ,
but also show errors;
.TP
.B --human
produce human-friendly output; this is the default (except
as noted below);
.TP
.B --raw
produce machine-friendly output; this is the default if
.B clinfo
is invoked with a name that contains the string
.RI \*(lq raw \*(rq;
.TP
.B --json
outputs the raw data (cf. the
.B --raw
option) in JSON format; support for this option is experimental,
as the representation of some of the values is not finalized;
.TP
.B --offline
shows also offline devices for platforms that expose this feature;
.TP
.B --null-platform
tries to handle the NULL platform as a normal platform,
retrieving and showing its properties and devices;
this is in addition to the NULL platform behavior tests done at the end,
and can be useful on systems where there are no ICD platforms,
but there is a platform hard-coded in the OpenCL library itself;
.TP
.BR -l ", " --list
list platforms and devices by name, with no (other) properties;
.TP
.BI -d " platform_index" : device_index
.TQ
.BI --device " platform_index" : device_index
only show properties for the specified device in the specified platform;
multiple device specifications may be given on the command-line;
.TP
.BI --prop " property-name"
only show properties whose symbolic name matches
(contains as a substring) the given
.IR property-name ;
the name is normalized as upper-case and with minus sign (-)
replaced by underscore signs (_);
multiple property specifications may be given on the command-line;
when this flag is specified, raw mode is forced;
.TP
.BR --help ", " -? ", " -h
show usage;
.TP
.BR --version ", " -v
show program version.

.SH CONFORMING TO

OpenCL 1.1, OpenCL 1.2, OpenCL 2.0, OpenCL 2.1, OpenCL 2.2, OpenCL 3.0.

.SH EXTENSIONS

Supported OpenCL extensions:
.TP 2
.B cl_khr_device_uuid
for the UUID, LUID and node mask of the device;
.TP
.B cl_khr_extended_versioning
for the extended platform, device, extension and IL versioned properties
backported from OpenCL 3.0 to previous OpenCL versions;
.TP
.BR cl_khr_fp16 ", " cl_khr_fp64 ", " cl_amd_fp64 ", " cl_APPLE_fp64_basic_ops
for information about support for half-precision and double-precision
floating-point data types;
.TP
.B cl_khr_image2d_from_buffer
for information about the base address and pitch alignment requirements
of buffers to be used as base for 2D images;
.TP
.B cl_khr_il_program
for information about the supported IL (Intermediate Language) representations;
.TP
.B cl_khr_spir
for information about the supported SPIR (Standard Portable Intermediate
Representation) versions;
.TP
.B cl_khr_icd
for the suffix of vendor extensions functions;
.TP
.B cl_khr_subgroup_named_barrier
for the maximum number of named sub-group barriers;
.TP
.BI cl_khr_terminate_context ", " cl_arm_controlled_kernel_termination
for the terminate capabilities for the device;
.TP
.B cl_ext_device_fission
for device fission support in OpenCL 1.1 devices;
.TP
.B cl_khr_pci_bus_info
for the PCI bus information (see also
.BR cl_nv_device_attribute_query " and"
.BR cl_amd_device_attribute_query )
.TP
.B cl_ext_atomic_counters_32
.TQ
.B cl_ext_atomic_counters_64
for the atomic counter extension;
.TP
.B cl_ext_cxx_for_opencl
for the version of the C++ for OpenCL language supported by the device compiler;
.TP
.B cl_amd_device_attribute_query
for AMD-specific device attributes;
.TP
.B cl_amd_object_metadata
to show the maximum number of keys supported by the platform;
.TP
.B cl_amd_offline_devices
to show offline devices exposed by the platform, if requested (see
.B --offline
option);
.TP
.B cl_amd_copy_buffer_p2p
to show the number and IDs of available P2P devices;
.TP
.B cl_amd_svm
.TQ
.B cl_arm_shared_virtual_memory
for Shared Virtual Memory (SVM) capabilities in OpenCL 1.2 devices;
.TP
.B cl_arm_core_id
to show the (potentially sparse) list of the core IDs that the device may
return;
.TP
.B cl_arm_job_slot_selection
to show the (potentially sparse) list of available job slots for command
submission;
.TP
.B cl_arm_scheduling_controls
to show the supported work scheduling controls and the available sets of register allocations;
.TP
.B cl_nv_device_attribute_query
for NVIDIA-specific device attributes;
.TP
.B cl_intel_device_attribute_query
for Intel-specific device attributes;
.TP
.B cl_intel_exec_by_local_thread
for the Intel extension allowing CPU devices to run kernels as part of
the current host thread;
.TP
.B cl_intel_advanced_motion_estimation
for the version of the Intel Motion Estimation accelerator version;
.TP
.B cl_intel_device_side_avc_motion_estimation
for the version and supported features of Intel's device-side AVC Motion;
.TP
.B cl_intel_planar_yuv
for the maximum dimensions of planar YUV images;
.TP
.B cl_intel_simultaneous_sharing
for simultaneous CL/GL/DirectX context sharing (only partial support);
.TP
.B cl_intel_required_subgroup_size
to enumerate allowed sub-group sizes;
.TP
.B cl_intel_command_queue_families
to enumerate the available command queues and their properties and capabilities;
.TP
.B cl_altera_device_temperature
for the Altera extension to query the core temperature of the device;
.TP
.B cl_qcom_ext_host_ptr
for the QUALCOMM extension to query page size and required padding in external
memory allocation.

.SH NOTES
Some information is duplicated when available from multiple sources.
Examples:
.IP \(bu 2
supported device partition types and domains as obtained using the
.B cl_ext_device_fission
extension typically match the ones obtained using
the core OpenCL 1.2 device partition feature;
.IP \(bu
the preferred work-group size multiple matches the NVIDIA warp size (on
NVIDIA devices) or the AMD wavefront width (on AMD devices).

.P
Some floating-point configuration flags may only be meaningful for
specific precisions and/or specific OpenCL versions. For example,
.B CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
is only relevant for single precision in OpenCL 1.2 devices.

.P
The implementation-defined behavior for NULL platform or context
properties is tested for the following API calls:
.TP 2
.B clGetPlatformInfo()
by trying to show the platform name;
.TP
.B clGetDeviceIDs()
by trying to enumerate devices; the corresponding platform (if any)
is then detected by querying the device platform of the first device;
.TP
.B clCreateteContext()
by trying to create a context from a device from the previous
list (if any), and a context from a device from a different platform;
.TP
.B clCreateteContextFromType()
by trying to create contexts for each device type (except DEFAULT).

.SH EXPERIMENTAL FEATURES
.P
Support for OpenCL 2.x properties is not fully tested.

.P
Support for
.B cl_khr_subgroup_named_barrier
is experimental due to missing definitions in the official OpenCL headers.

.P
Raw (machine-parsable) output is considered experimental, the output format
might still undergo changes.

.P
The properties of the ICD loader will also be queried if the
.B clGetICDLoaderInfoOCLICD
extension function is found.

.P
Support for the properties exposed by
.B cl_amd_copy_buffer_p2p
is experimental.

.P
Support for some (documented and undocumented) properties exposed by
.B cl_amd_device_attribute_query
is experimental (see also
.BR LIMITATIONS ).

.P
Support for the interop lists exposed by
.B cl_intel_simultaneous_sharing
is experimental.

.P
The highest OpenCL version supported by the ICD loader is detected
with some trivial heuristics (symbols found); a notice is output
if this is lower than the highest platform OpenCL version, or
if the detected version doesn't match the one declared by the ICD
loader itself.

.SH LIMITATIONS

.P
OpenCL did not provide an explicit mean to detect the supported version
of any extension exposed by a device until version 3.0. This makes it impossible
in many circumstances to determine a priori if it will be possible to successfully query
a device about a specific property even if it declares support for a given extension.
Additionally, the actual size and meaning of some properties are not
officially declared anywhere.

.P
Most notably, this affects extensions such as
.BR cl_amd_device_attribute_query ,
.B cl_nv_device_attribute_query
and
.BR cl_arm_core_id .
Heuristics based on standard version support are partially used in the code to
determine which version may be supported.

.P
Properties which are known to be affected by these limitations include:

.TP 2
.B CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
documented in v3 of the
.B cl_amd_device_attribute_query
extension specification as being the global free memory in KBytes, without
any explanation given on why there are two values, although in the source code
of the
.B ROCm
stack the second value is documented as being the largest free block;
.TP
.B CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD
documented in v3 of the
.B cl_amd_device_attribute_query
extension specification, but not reported by drivers supporting other v3
properties. This has now been enabled for drivers
.I assumed
to support v4 of the same extension;
.TP
.B CL_DEVICE_TERMINATE_CAPABILITY_KHR
exposed by the
.B cl_khr_terminate_context
has changed value between OpenCL 1.x and 2.x, and it's
.I allegedly
a bitfield, whose values are however not defined anywhere.

.SH BUGS

.SS General

.P
Please report any issues on
.UR http://github.com/Oblomov/clinfo
the project tracker on GitHub
.UE .

.SS LLVM CommandLine errors

.P
If multiple OpenCL platforms using shared
.B LLVM
libraries are present in the system,
.B clinfo
(and other OpenCL application) may crash with errors
to the tune of
.PP
.nf
.RS
.B : CommandLine Error: Option '(some option name)' registered more than once!
.B LLVM ERROR: inconsistency in registered CommandLine options
.RE
.fi
.PP
or similar. This is not an issue in
.BR clinfo ","
or in any OpenCL platform or application, but it is due to the way
.B LLVM
handles its own command-line options parsing.
The issue has been reported upstream
.UR https://bugs.llvm.org/show_bug.cgi?id=30587
as issue #30587
.UE .
See the next point for possible workarounds and assistance in identifying the
conflicting platforms.

.SS Segmentation faults

.P
Faulty OpenCL platforms may cause segmentation faults in
.B clinfo
during the information gathering phase, sometimes even
before any output is shown. There is very little
.B clinfo
can do to avoid this. If you see this happening,
try disabling all platforms and then re-enabling
them one by one until you experience the crash again.
Chances are the last platform you enabled is defective
in some way (either by being incompatible with other
platforms or by missing necessary components and
not handling their absence gracefully).

.P
To selectively enable/disable platforms, one
way is to move or rename the
.I *.icd
files present in
.I /etc/OpenCL/vendors/
and then restoring them one by one. When using
the free-software
.B ocl-icd
OpenCL library, a similar effect can be achieved
by setting the
.B OPENCL_VENDOR_PATH
or
.B OCL_ICD_VENDORS
environment variables, as documented in
.BR libOpenCL (7).
Other implementations of
.B libOpenCL
are known to support
.B OPENCL_VENDOR_PATH
too.

.TP 2
.B Example
find /etc/OpenCL/vendors/ -name '*.icd' | while read OPENCL_VENDOR_PATH ; do clinfo -l > /dev/null ; echo "$? ${OPENCL_VENDOR_PATH}" ; done

.P
This one liner will run
.B clinfo -l
for each platform individually (hiding the normal output),
and report the
.I .icd
path prefixed by
.B 0
for successful runs, and a non-zero value for faulty
platforms.
